home *** CD-ROM | disk | FTP | other *** search
/ MacAddict 108 / MacAddict108.iso / Software / Internet & Communication / WordPress 1.5.1.dmg / wordpress / wp-admin / upgrade-schema.php < prev    next >
Encoding:
PHP Script  |  2005-05-03  |  10.1 KB  |  235 lines

  1. <?php
  2. // Here we keep the DB structure and option values
  3.  
  4. $wp_queries="CREATE TABLE $wpdb->categories (
  5.   cat_ID bigint(20) NOT NULL auto_increment,
  6.   cat_name varchar(55) NOT NULL default '',
  7.   category_nicename varchar(200) NOT NULL default '',
  8.   category_description longtext NOT NULL,
  9.   category_parent int(4) NOT NULL default '0',
  10.   PRIMARY KEY  (cat_ID),
  11.   KEY category_nicename (category_nicename)
  12. );
  13. CREATE TABLE $wpdb->comments (
  14.   comment_ID bigint(20) unsigned NOT NULL auto_increment,
  15.   comment_post_ID int(11) NOT NULL default '0',
  16.   comment_author tinytext NOT NULL,
  17.   comment_author_email varchar(100) NOT NULL default '',
  18.   comment_author_url varchar(200) NOT NULL default '',
  19.   comment_author_IP varchar(100) NOT NULL default '',
  20.   comment_date datetime NOT NULL default '0000-00-00 00:00:00',
  21.   comment_date_gmt datetime NOT NULL default '0000-00-00 00:00:00',
  22.   comment_content text NOT NULL,
  23.   comment_karma int(11) NOT NULL default '0',
  24.   comment_approved enum('0','1','spam') NOT NULL default '1',
  25.   comment_agent varchar(255) NOT NULL default '',
  26.   comment_type varchar(20) NOT NULL default '',
  27.   comment_parent int(11) NOT NULL default '0',
  28.   user_id int(11) NOT NULL default '0',
  29.   PRIMARY KEY  (comment_ID),
  30.   KEY comment_approved (comment_approved),
  31.   KEY comment_post_ID (comment_post_ID)
  32. );
  33. CREATE TABLE $wpdb->linkcategories (
  34.   cat_id bigint(20) NOT NULL auto_increment,
  35.   cat_name tinytext NOT NULL,
  36.   auto_toggle enum('Y','N') NOT NULL default 'N',
  37.   show_images enum('Y','N') NOT NULL default 'Y',
  38.   show_description enum('Y','N') NOT NULL default 'N',
  39.   show_rating enum('Y','N') NOT NULL default 'Y',
  40.   show_updated enum('Y','N') NOT NULL default 'Y',
  41.   sort_order varchar(64) NOT NULL default 'rand',
  42.   sort_desc enum('Y','N') NOT NULL default 'N',
  43.   text_before_link varchar(128) NOT NULL default '<li>',
  44.   text_after_link varchar(128) NOT NULL default '<br />',
  45.   text_after_all varchar(128) NOT NULL default '</li>',
  46.   list_limit int(11) NOT NULL default '-1',
  47.   PRIMARY KEY  (cat_id)
  48. );
  49. CREATE TABLE $wpdb->links (
  50.   link_id bigint(20) NOT NULL auto_increment,
  51.   link_url varchar(255) NOT NULL default '',
  52.   link_name varchar(255) NOT NULL default '',
  53.   link_image varchar(255) NOT NULL default '',
  54.   link_target varchar(25) NOT NULL default '',
  55.   link_category int(11) NOT NULL default '0',
  56.   link_description varchar(255) NOT NULL default '',
  57.   link_visible enum('Y','N') NOT NULL default 'Y',
  58.   link_owner int(11) NOT NULL default '1',
  59.   link_rating int(11) NOT NULL default '0',
  60.   link_updated datetime NOT NULL default '0000-00-00 00:00:00',
  61.   link_rel varchar(255) NOT NULL default '',
  62.   link_notes mediumtext NOT NULL,
  63.   link_rss varchar(255) NOT NULL default '',
  64.   PRIMARY KEY  (link_id),
  65.   KEY link_category (link_category),
  66.   KEY link_visible (link_visible)
  67. );
  68. CREATE TABLE $wpdb->options (
  69.   option_id bigint(20) NOT NULL auto_increment,
  70.   blog_id int(11) NOT NULL default '0',
  71.   option_name varchar(64) NOT NULL default '',
  72.   option_can_override enum('Y','N') NOT NULL default 'Y',
  73.   option_type int(11) NOT NULL default '1',
  74.   option_value longtext NOT NULL,
  75.   option_width int(11) NOT NULL default '20',
  76.   option_height int(11) NOT NULL default '8',
  77.   option_description tinytext NOT NULL,
  78.   option_admin_level int(11) NOT NULL default '1',
  79.   autoload enum('yes','no') NOT NULL default 'yes',
  80.   PRIMARY KEY  (option_id,blog_id,option_name),
  81.   KEY option_name (option_name)
  82. );
  83. CREATE TABLE $wpdb->post2cat (
  84.   rel_id bigint(20) NOT NULL auto_increment,
  85.   post_id bigint(20) NOT NULL default '0',
  86.   category_id bigint(20) NOT NULL default '0',
  87.   PRIMARY KEY  (rel_id),
  88.   KEY post_id (post_id,category_id)
  89. );
  90. CREATE TABLE $wpdb->postmeta (
  91.   meta_id bigint(20) NOT NULL auto_increment,
  92.   post_id bigint(20) NOT NULL default '0',
  93.   meta_key varchar(255) default NULL,
  94.   meta_value text,
  95.   PRIMARY KEY  (meta_id),
  96.   KEY post_id (post_id),
  97.   KEY meta_key (meta_key)
  98. );
  99. CREATE TABLE $wpdb->posts (
  100.   ID bigint(20) unsigned NOT NULL auto_increment,
  101.   post_author int(4) NOT NULL default '0',
  102.   post_date datetime NOT NULL default '0000-00-00 00:00:00',
  103.   post_date_gmt datetime NOT NULL default '0000-00-00 00:00:00',
  104.   post_content longtext NOT NULL,
  105.   post_title text NOT NULL,
  106.   post_category int(4) NOT NULL default '0',
  107.   post_excerpt text NOT NULL,
  108.   post_status enum('publish','draft','private','static','object') NOT NULL default 'publish',
  109.   comment_status enum('open','closed','registered_only') NOT NULL default 'open',
  110.   ping_status enum('open','closed') NOT NULL default 'open',
  111.   post_password varchar(20) NOT NULL default '',
  112.   post_name varchar(200) NOT NULL default '',
  113.   to_ping text NOT NULL,
  114.   pinged text NOT NULL,
  115.   post_modified datetime NOT NULL default '0000-00-00 00:00:00',
  116.   post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00',
  117.   post_content_filtered text NOT NULL,
  118.   post_parent int(11) NOT NULL default '0',
  119.   guid varchar(255) NOT NULL default '',
  120.   menu_order int(11) NOT NULL default '0',
  121.   PRIMARY KEY  (ID),
  122.   KEY post_name (post_name)
  123. );
  124. CREATE TABLE $wpdb->users (
  125.   ID bigint(20) unsigned NOT NULL auto_increment,
  126.   user_login varchar(60) NOT NULL default '',
  127.   user_pass varchar(64) NOT NULL default '',
  128.   user_firstname varchar(50) NOT NULL default '',
  129.   user_lastname varchar(50) NOT NULL default '',
  130.   user_nickname varchar(50) NOT NULL default '',
  131.   user_nicename varchar(50) NOT NULL default '',
  132.   user_icq int(10) unsigned NOT NULL default '0',
  133.   user_email varchar(100) NOT NULL default '',
  134.   user_url varchar(100) NOT NULL default '',
  135.   user_ip varchar(15) NOT NULL default '',
  136.   user_domain varchar(200) NOT NULL default '',
  137.   user_browser varchar(200) NOT NULL default '',
  138.   user_registered datetime NOT NULL default '0000-00-00 00:00:00',
  139.   user_level int(2) unsigned NOT NULL default '0',
  140.   user_aim varchar(50) NOT NULL default '',
  141.   user_msn varchar(100) NOT NULL default '',
  142.   user_yim varchar(50) NOT NULL default '',
  143.   user_idmode varchar(20) NOT NULL default '',
  144.   user_activation_key varchar(60) NOT NULL default '',
  145.   user_status int(11) NOT NULL default '0',
  146.   user_description longtext NOT NULL default '',
  147.   PRIMARY KEY  (ID),
  148.   UNIQUE KEY user_login (user_login)
  149. );";
  150.  
  151. function populate_options() {
  152.     global $wpdb;
  153.  
  154.     $guessurl = preg_replace('|/wp-admin/.*|i', '', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
  155.     add_option('siteurl', $guessurl, __('WordPress web address'));
  156.     add_option('blogname', __('My Weblog'), __('Blog title'));
  157.     add_option('blogdescription', __('Just another WordPress weblog'), __('Short tagline'));
  158.     add_option('new_users_can_blog', 0);
  159.     add_option('users_can_register', 0);
  160.     add_option('admin_email', 'you@example.com');
  161.     add_option('start_of_week', 1);
  162.     add_option('use_balanceTags', 1);
  163.     add_option('use_smilies', 1);
  164.     add_option('require_name_email', 1);
  165.     add_option('comments_notify', 1);
  166.     add_option('posts_per_rss', 10);
  167.     add_option('rss_excerpt_length', 50);
  168.     add_option('rss_use_excerpt', 0);
  169.     add_option('use_fileupload', 0);
  170.     add_option('fileupload_realpath', ABSPATH . 'wp-content');
  171.     add_option('fileupload_url', get_option('siteurl') . '/wp-content');
  172.     add_option('fileupload_allowedtypes', 'jpg jpeg gif png');
  173.     add_option('fileupload_maxk', 300);
  174.     add_option('fileupload_minlevel', 6);
  175.     add_option('mailserver_url', 'mail.example.com');
  176.     add_option('mailserver_login', 'login@example.com');
  177.     add_option('mailserver_pass', 'password');
  178.     add_option('mailserver_port', 110);
  179.     add_option('default_category', 1);
  180.     add_option('default_comment_status', 'open');
  181.     add_option('default_ping_status', 'open');
  182.     add_option('default_pingback_flag', 1);
  183.     add_option('default_post_edit_rows', 9);
  184.     add_option('posts_per_page', 10);
  185.     add_option('what_to_show', 'posts');
  186.     add_option('date_format', __('F j, Y'));
  187.     add_option('time_format', __('g:i a'));
  188.     add_option('links_updated_date_format', __('F j, Y g:i a'));
  189.     add_option('links_recently_updated_prepend', '<em>');
  190.     add_option('links_recently_updated_append', '</em>');
  191.     add_option('links_recently_updated_time', 120);
  192.     add_option('comment_moderation', 0);
  193.     add_option('moderation_notify', 1);
  194.     add_option('permalink_structure');
  195.     add_option('gzipcompression', 0);
  196.     add_option('hack_file', 0);
  197.     add_option('blog_charset', 'UTF-8');
  198.     add_option('moderation_keys');
  199.     add_option('active_plugins');
  200.     add_option('home');
  201.     add_option('category_base');
  202.     add_option('ping_sites', 'http://rpc.pingomatic.com/');
  203.     add_option('advanced_edit', 0);
  204.     add_option('comment_max_links', 2);
  205.     // 1.5
  206.     add_option('default_email_category', 1, __('Posts by email go to this category'));
  207.     add_option('recently_edited');
  208.     add_option('use_linksupdate', 0);
  209.     add_option('template', 'default');
  210.     add_option('stylesheet', 'default');
  211.     add_option('comment_whitelist', 1);
  212.     add_option('page_uris');
  213.     add_option('blacklist_keys');
  214.     add_option('comment_registration', 0);
  215.     add_option('open_proxy_check', 1);
  216.     add_option('rss_language', 'en');
  217.     add_option('html_type', 'text/html');
  218.     // 1.5.1
  219.     add_option('use_trackback', 0);
  220.  
  221.     // Delete unused options
  222.     $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url');
  223.     foreach ($unusedoptions as $option) :
  224.         delete_option($option);
  225.     endforeach;
  226.  
  227.     // Set up a few options not to load by default
  228.     $fatoptions = array( 'moderation_keys', 'recently_edited', 'blacklist_keys' );
  229.     foreach ($fatoptions as $fatoption) :
  230.         $wpdb->query("UPDATE $wpdb->options SET `autoload` = 'no' WHERE option_name = '$fatoption'");
  231.     endforeach;
  232. }
  233.  
  234. ?>
  235.